"""
本代码由[Tkinter布局助手]生成
官网:https://www.pytk.net
QQ交流群:905019785
在线反馈:https://support.qq.com/product/618914
"""
import random
from tkinter import *
from tkinter.ttk import *
class WinGUI(Tk):
    def __init__(self):
        super().__init__()
        self.__win()
        self.tk_label_frame_mco9k7ss = self.__tk_label_frame_mco9k7ss(self)
        self.tk_input_ui_data_path_1 = self.__tk_input_ui_data_path_1( self.tk_label_frame_mco9k7ss) 
        self.tk_label_mco9l997 = self.__tk_label_mco9l997( self.tk_label_frame_mco9k7ss) 
        self.tk_label_mco9loyn = self.__tk_label_mco9loyn( self.tk_label_frame_mco9k7ss) 
        self.tk_label_mco9lqpp = self.__tk_label_mco9lqpp( self.tk_label_frame_mco9k7ss) 
        self.tk_input_ui_data_path_2 = self.__tk_input_ui_data_path_2( self.tk_label_frame_mco9k7ss) 
        self.tk_input_ui_data_path_3 = self.__tk_input_ui_data_path_3( self.tk_label_frame_mco9k7ss) 
        self.tk_button_ui_browse_1 = self.__tk_button_ui_browse_1( self.tk_label_frame_mco9k7ss) 
        self.tk_button_ui_browse_2 = self.__tk_button_ui_browse_2( self.tk_label_frame_mco9k7ss) 
        self.tk_button_ui_browse_3 = self.__tk_button_ui_browse_3( self.tk_label_frame_mco9k7ss) 
        self.tk_button_ui_open_1 = self.__tk_button_ui_open_1( self.tk_label_frame_mco9k7ss) 
        self.tk_button_ui_open_2 = self.__tk_button_ui_open_2( self.tk_label_frame_mco9k7ss) 
        self.tk_button_ui_open_3 = self.__tk_button_ui_open_3( self.tk_label_frame_mco9k7ss) 
        self.tk_label_mco9to3h = self.__tk_label_mco9to3h( self.tk_label_frame_mco9k7ss) 
        self.tk_input_ui_output_path = self.__tk_input_ui_output_path( self.tk_label_frame_mco9k7ss) 
        self.tk_button_ui_browse_4 = self.__tk_button_ui_browse_4( self.tk_label_frame_mco9k7ss) 
        self.tk_button_ui_open_4 = self.__tk_button_ui_open_4( self.tk_label_frame_mco9k7ss) 
        self.tk_label_frame_mco9vstj = self.__tk_label_frame_mco9vstj(self)
        self.tk_label_mco9x9l2 = self.__tk_label_mco9x9l2( self.tk_label_frame_mco9vstj) 
        self.tk_text_mco9xj29 = self.__tk_text_mco9xj29( self.tk_label_frame_mco9vstj) 
        self.tk_label_mco9xt7r = self.__tk_label_mco9xt7r( self.tk_label_frame_mco9vstj) 
        self.tk_label_mco9y1uc = self.__tk_label_mco9y1uc( self.tk_label_frame_mco9vstj) 
        self.tk_radio_button_mco9ysmo = self.__tk_radio_button_mco9ysmo( self.tk_label_frame_mco9vstj) 
        self.tk_radio_button_mco9yty1 = self.__tk_radio_button_mco9yty1( self.tk_label_frame_mco9vstj) 
        self.tk_text_mcoa0k35 = self.__tk_text_mcoa0k35( self.tk_label_frame_mco9vstj) 
        self.tk_button_mcoa9wa5 = self.__tk_button_mcoa9wa5( self.tk_label_frame_mco9vstj) 
        self.tk_button_mcoa9xtc = self.__tk_button_mcoa9xtc( self.tk_label_frame_mco9vstj) 
        self.tk_button_mcoa9yw0 = self.__tk_button_mcoa9yw0( self.tk_label_frame_mco9vstj) 
        self.tk_label_frame_mcoadlaz = self.__tk_label_frame_mcoadlaz(self)
        self.tk_text_mcoaf5p8 = self.__tk_text_mcoaf5p8( self.tk_label_frame_mcoadlaz) 
    def __win(self):
        self.title("降幅在")
        # 设置窗口大小、居中
        width = 795
        height = 740
        screenwidth = self.winfo_screenwidth()
        screenheight = self.winfo_screenheight()
        geometry = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
        self.geometry(geometry)
        
        self.resizable(width=False, height=False)
        
    def scrollbar_autohide(self,vbar, hbar, widget):
        """自动隐藏滚动条"""
        def show():
            if vbar: vbar.lift(widget)
            if hbar: hbar.lift(widget)
        def hide():
            if vbar: vbar.lower(widget)
            if hbar: hbar.lower(widget)
        hide()
        widget.bind("<Enter>", lambda e: show())
        if vbar: vbar.bind("<Enter>", lambda e: show())
        if vbar: vbar.bind("<Leave>", lambda e: hide())
        if hbar: hbar.bind("<Enter>", lambda e: show())
        if hbar: hbar.bind("<Leave>", lambda e: hide())
        widget.bind("<Leave>", lambda e: hide())
    
    def v_scrollbar(self,vbar, widget, x, y, w, h, pw, ph):
        widget.configure(yscrollcommand=vbar.set)
        vbar.config(command=widget.yview)
        vbar.place(relx=(w + x) / pw, rely=y / ph, relheight=h / ph, anchor='ne')
    def h_scrollbar(self,hbar, widget, x, y, w, h, pw, ph):
        widget.configure(xscrollcommand=hbar.set)
        hbar.config(command=widget.xview)
        hbar.place(relx=x / pw, rely=(y + h) / ph, relwidth=w / pw, anchor='sw')
    def create_bar(self,master, widget,is_vbar,is_hbar, x, y, w, h, pw, ph):
        vbar, hbar = None, None
        if is_vbar:
            vbar = Scrollbar(master)
            self.v_scrollbar(vbar, widget, x, y, w, h, pw, ph)
        if is_hbar:
            hbar = Scrollbar(master, orient="horizontal")
            self.h_scrollbar(hbar, widget, x, y, w, h, pw, ph)
        self.scrollbar_autohide(vbar, hbar, widget)
    def __tk_label_frame_mco9k7ss(self,parent):
        frame = LabelFrame(parent,text="目录设置",)
        frame.place(x=5, y=0, width=760, height=190)
        return frame
    def __tk_input_ui_data_path_1(self,parent):
        ipt = Entry(parent, )
        ipt.place(x=105, y=10, width=500, height=30)
        return ipt
    def __tk_label_mco9l997(self,parent):
        label = Label(parent,text="数据目录1：",anchor="center", )
        label.place(x=15, y=10, width=80, height=30)
        return label
    def __tk_label_mco9loyn(self,parent):
        label = Label(parent,text="数据目录2：",anchor="center", )
        label.place(x=15, y=50, width=80, height=30)
        return label
    def __tk_label_mco9lqpp(self,parent):
        label = Label(parent,text="数据目录3：",anchor="center", )
        label.place(x=15, y=90, width=80, height=30)
        return label
    def __tk_input_ui_data_path_2(self,parent):
        ipt = Entry(parent, )
        ipt.place(x=105, y=50, width=500, height=30)
        return ipt
    def __tk_input_ui_data_path_3(self,parent):
        ipt = Entry(parent, )
        ipt.place(x=105, y=90, width=500, height=30)
        return ipt
    def __tk_button_ui_browse_1(self,parent):
        btn = Button(parent, text="浏览", takefocus=False,)
        btn.place(x=615, y=10, width=50, height=30)
        return btn
    def __tk_button_ui_browse_2(self,parent):
        btn = Button(parent, text="浏览", takefocus=False,)
        btn.place(x=615, y=50, width=50, height=30)
        return btn
    def __tk_button_ui_browse_3(self,parent):
        btn = Button(parent, text="浏览", takefocus=False,)
        btn.place(x=615, y=90, width=50, height=30)
        return btn
    def __tk_button_ui_open_1(self,parent):
        btn = Button(parent, text="打开目录", takefocus=False,)
        btn.place(x=680, y=10, width=70, height=30)
        return btn
    def __tk_button_ui_open_2(self,parent):
        btn = Button(parent, text="打开目录", takefocus=False,)
        btn.place(x=680, y=50, width=70, height=30)
        return btn
    def __tk_button_ui_open_3(self,parent):
        btn = Button(parent, text="打开目录", takefocus=False,)
        btn.place(x=680, y=90, width=70, height=30)
        return btn
    def __tk_label_mco9to3h(self,parent):
        label = Label(parent,text="数据目录3：",anchor="center", )
        label.place(x=15, y=130, width=80, height=30)
        return label
    def __tk_input_ui_output_path(self,parent):
        ipt = Entry(parent, )
        ipt.place(x=105, y=130, width=500, height=30)
        return ipt
    def __tk_button_ui_browse_4(self,parent):
        btn = Button(parent, text="浏览", takefocus=False,)
        btn.place(x=615, y=130, width=50, height=30)
        return btn
    def __tk_button_ui_open_4(self,parent):
        btn = Button(parent, text="打开目录", takefocus=False,)
        btn.place(x=680, y=130, width=70, height=30)
        return btn
    def __tk_label_frame_mco9vstj(self,parent):
        frame = LabelFrame(parent,text="格式：",)
        frame.place(x=5, y=200, width=760, height=320)
        return frame
    def __tk_label_mco9x9l2(self,parent):
        label = Label(parent,text="用例：",anchor="center", )
        label.place(x=15, y=30, width=50, height=30)
        return label
    def __tk_text_mco9xj29(self,parent):
        text = Text(parent)
        text.place(x=100, y=0, width=650, height=100)
        return text
    def __tk_label_mco9xt7r(self,parent):
        label = Label(parent,text="格式：",anchor="center", )
        label.place(x=15, y=110, width=735, height=30)
        return label
    def __tk_label_mco9y1uc(self,parent):
        label = Label(parent,text="进程名：",anchor="center", )
        label.place(x=15, y=180, width=50, height=30)
        return label
    def __tk_radio_button_mco9ysmo(self,parent):
        rb = Radiobutton(parent,text="全量函数",)
        rb.place(x=15, y=260, width=80, height=30)
        return rb
    def __tk_radio_button_mco9yty1(self,parent):
        rb = Radiobutton(parent,text="分摊swapper",)
        rb.place(x=110, y=260, width=120, height=30)
        return rb
    def __tk_text_mcoa0k35(self,parent):
        text = Text(parent)
        text.place(x=100, y=150, width=650, height=100)
        return text
    def __tk_button_mcoa9wa5(self,parent):
        btn = Button(parent, text="生成", takefocus=False,)
        btn.place(x=540, y=260, width=80, height=30)
        return btn
    def __tk_button_mcoa9xtc(self,parent):
        btn = Button(parent, text="函数配置", takefocus=False,)
        btn.place(x=410, y=260, width=80, height=30)
        return btn
    def __tk_button_mcoa9yw0(self,parent):
        btn = Button(parent, text="打开结果", takefocus=False,)
        btn.place(x=670, y=260, width=80, height=30)
        return btn
    def __tk_label_frame_mcoadlaz(self,parent):
        frame = LabelFrame(parent,text="日志",)
        frame.place(x=5, y=525, width=760, height=200)
        return frame
    def __tk_text_mcoaf5p8(self,parent):
        text = Text(parent)
        text.place(x=15, y=0, width=735, height=170)
        return text
class Win(WinGUI):
    def __init__(self, controller):
        self.ctl = controller
        super().__init__()
        self.__event_bind()
        self.__style_config()
        self.ctl.init(self)
    def __event_bind(self):
        self.tk_button_ui_browse_1.bind('<Button>',self.ctl.browse_data_1)
        self.tk_button_ui_browse_2.bind('<Button>',self.ctl.browse_data_2)
        self.tk_button_ui_browse_3.bind('<Button>',self.ctl.browse_data_3)
        self.tk_button_ui_open_1.bind('<Button>',self.ctl.open_data_1)
        self.tk_button_ui_open_2.bind('<Button>',self.ctl.open_data_2)
        self.tk_button_ui_open_3.bind('<Button>',self.ctl.open_data_3)
        self.tk_button_ui_browse_4.bind('<Button>',self.ctl.browse_data_4)
        self.tk_button_ui_open_4.bind('<Button>',self.ctl.open_data_4)
        self.tk_button_mcoa9wa5.bind('<Button>',self.ctl.generate)
        self.tk_button_mcoa9xtc.bind('<Button>',self.ctl.set_function_config)
        self.tk_button_mcoa9yw0.bind('<Button>',self.ctl.open_result)
        pass
    def __style_config(self):
        pass
if __name__ == "__main__":
    win = WinGUI()
    win.mainloop()